using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using DevExpress.XtraReports.UI;
using System.Linq;
using System.Collections.Generic;
using System.Windows.Forms;

namespace QLTV.Reports
{
    public partial class rptTongHop : DevExpress.XtraReports.UI.XtraReport
    {
        public rptTongHop()
        {
            InitializeComponent();
            bindOnboard();
            bindVacation();
         
        }
        public void bindOnboard()
        {
            //onboard list
            ((rptOnBoard)part1.ReportSource).loadData(true, false, false, false);
            ((rptOnBoard)part2.ReportSource).loadData(false, true, false, false);
            ((rptOnBoard)part3.ReportSource).loadData(false, false, true, false);
            ((rptOnBoard)part4.ReportSource).loadData(false, false, false, true);

       

        }
        public void bindVacation()
        {
            ////Vacation list
           

            ((rptVacation)xrSubreport1.ReportSource).loadData(true, false, false, false);
            ((rptVacation)xrSubreport2.ReportSource).loadData(false, true, false, false);
            ((rptVacation)xrSubreport3.ReportSource).loadData(false, false, true, false);
            ((rptVacation)xrSubreport4.ReportSource).loadData(false, false, false, true);

        }
        int _stt = 0;
        private void Detail1_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
        {
            _stt++;
            stt.Text = String.Format("2.{0}.", _stt);
            if (vacationDetail.GetCurrentColumnValue("Department") != null)
            {
                ((rptVacation)xrSubreport1.ReportSource).RankType.Value = vacationDetail.GetCurrentColumnValue("Department").ToString();
                ((rptVacation)xrSubreport2.ReportSource).RankType.Value = vacationDetail.GetCurrentColumnValue("Department").ToString();
                ((rptVacation)xrSubreport3.ReportSource).RankType.Value = vacationDetail.GetCurrentColumnValue("Department").ToString();
                ((rptVacation)xrSubreport4.ReportSource).RankType.Value = vacationDetail.GetCurrentColumnValue("Department").ToString();
            }

        }

        private void Detail1_AfterPrint(object sender, EventArgs e)
        {
            //bindVacation();
        }
    }
}

